
public class Bucket 
{
	public byte[] data = new byte[100];
	public long offset =  Long.MAX_VALUE;
	public static int bucketLength=108;
	
	public Bucket()
	{
		offset = Long.MAX_VALUE;
		
	}
	public Bucket(byte[] input)
	{

		for(int i=0; i<input.length-8;i++)
		{
			data[i] = input[i];
		}
		byte [] off = new byte [8];
		for(int j=0; j<8; j++)
		{
			 off[j]= input[data.length+j];
		}
		i8 d = new i8();
		String t = d.getPrimitive(off)+"";
		offset = Long.parseLong(t);
	}
	public byte[] readBlock(int start, index i)
	{
		
		byte[] returnedBlock = new byte[(int)i.blockLength];
		int j=0;
		
		
		if(start+(int)i.blockLength > data.length)
			return null;
		char c= (char)data[start];
		
		if (c=='`')
			return null;
		
		else
		{	
				for(int k=start; k < start+(int)i.blockLength; k++)
				{
					returnedBlock[j] = data[k];
					j++;
				}
				return returnedBlock;
		}
	}
	public void writeBlock(byte[] data, int pointer,index i)
	{
		for(int k=0; k<i.blockLength;k++)
		{
			this.data[k+pointer] = data[k]; 
		}
		
		char c='`';
		
		byte b=(byte)c;
		if(pointer+i.blockLength< this.data.length)
		this.data[pointer+(int)i.blockLength]=b;
	}
	
}
